package com.emep.emeptime.entity;

import com.emep.emeptime.model.ApiData;
import com.emep.emeptime.model.DataAqiInfoComparator;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.lang.annotation.Annotation;

/**
 * @author xy
 * @Description: aqi数据表
 * @date 2018/3/23 17:14
 * @version V1.0
 */
@Data
@Entity
@Table(name = "data_aqi_info")
public class DataAqiInfo implements Serializable, Comparable<DataAqiInfo> {
    @Id
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @GeneratedValue(generator = "system-uuid")
    private String  id;
    @Column(name = "position_name",columnDefinition="varchar(100) COMMENT '监测站名称'" )
    private String positionName;
    @Column(name = "aqi",columnDefinition="varchar(100) COMMENT 'aqi'" )
    private String aqi;
    @Column(name = "area_id",columnDefinition="varchar(100) COMMENT '行政区划'" )
    private String areaId;
    @Column(name = "composite_index",columnDefinition="varchar(100) COMMENT '综合指数'" )
    private String compositeIndex;
    @Column(name = "co",columnDefinition="varchar(100) COMMENT '一氧化碳'" )
    private String co;
    @Column(name = "no2",columnDefinition="varchar(100) COMMENT '二氧化氮'" )
    private String no2;
    @Column(name = "o3",columnDefinition="varchar(100) COMMENT '臭氧'" )
    private String o3;
    @Column(name = "pm10",columnDefinition="varchar(100) COMMENT 'pm10'" )
    private String pm10;
    @Column(name = "so2",columnDefinition="varchar(100) COMMENT '二氧化硫'" )
    private String so2;
    @Column(name = "pm25",columnDefinition="varchar(100) COMMENT 'pm2.5'" )
    private String pm25;
    @Column(name = "primary_pollutant",columnDefinition="varchar(100) COMMENT '首要污染物'" )
    private String primaryPollutant;
    @Column(name = "qualityId",columnDefinition="varchar(100) COMMENT '空气质量id'" )
    private String qualityId;
    @Column(name = "quality_code",columnDefinition="varchar(100) COMMENT '空气质量等级'" )
    private String qualityCode;
    @Column(name = "time_point",columnDefinition="varchar(100) COMMENT '数据时间'" )
    private String timePoint;
    @Column(name = "save_date",columnDefinition="varchar(100) COMMENT '时间'" )
    @OrderBy("startTime DESC")
    private String saveDate = String.valueOf(System.currentTimeMillis());


    @Override
    public int compareTo(DataAqiInfo o) {
        return new DataAqiInfoComparator().compare(this,o);
    }
}
